<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Redux</title>
  </head>
  <body>
    <script src="../../source/dist/redux.js"></script>
    <script>
      const reducer = (state, action) => {
        switch (action.type) {
          case "Add":
            return state + 1
            break
          default:
            return 0
            break
        }
      }
      const store = Redux.createStore(reducer)

      store.subscribe(() => {
        console.log("subscribe", store.getState())
      })

      store.dispatch({     // state = 1
        type: "Add",
      })
      store.dispatch({     // state = 2
        type: "Add",
      })
      store.dispatch({     // state = 0
        type: "NoActionType",
      })
      store.dispatch({     // state = 1
        type: "Add",
      })
    </script>
  </body>
</html>
